<?php
include "../../inc/log/adsession.php";
// include "../../inc/data/connAdmin.php";
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<?php
	include "../../inc/data/connAdmin.php";
	$str = $_GET['q'];
   	$coterm = substr($str,0,1);
  	$majorName = substr($str,2);
	$sql = "select cocode,coname,coterm,copolint,coweekh,coweek,cotype,coexam ,majorname,cograde
			from mamx_course 
    		where coterm = ? and majorname= ?";
	$stmt=$conn->prepare($sql);
	$stmt->bind_param("si",$coterm,$majorName);
  	
	$stmt->execute();
	$stmt->bind_result($cCode,$cName,$coterm,$cPoint,$cWeekh,$cWeek,$cType,$cExam,$majorName,$cGrade);
	$stmt->store_result();
	$stmt->fetch();
?>
<table id="table" style="width:70%;border:4px solid #1D50A2;margin:0 auto;text-align:center;">
    <tr style="font-weight:bold;color:#43a85e">
      <td>课程编号</td>
      <td>课程名称</td>
      <td>开课学期</td>
      <td>学分</td>
      <td>周课时</td>
      <td>起止周</td>
      <td>课程类型</td>
      <td>考核方式</td>
      <td>开课专业</td>
      <td>适用年级</td>
      <td>操作</td>
    </tr>
<?php
	while ($stmt->fetch()){
		echo <<<END
	    <tr>
		    <td>$cCode</td>
		    <td>$cName</td>
		    <td>$coterm</td>
		    <td>$cPoint</td>
		    <td>$cWeekh</td>
		    <td>$cWeek</td>
		    <td>$cType</td>
		    <td>$cExam</td>
		    <td>$majorName</td>
		    <td>$cGrade</td> 
	        <td  style="font-weight:bold;">
	      		<a href="" onclick="if(confirm('确定要删除 $cName 吗?')) location='courseDel.php?cocode=$cCode'" style="color:#f79b28">删除</a> / 
				<a href="courseModi.php?cocode=$cCode" style="color:#287bf7">修改</a>
	      	</td>
	    </tr>
END;
    }
?>
 </table>
</body>
</html>